<!doctype html><html lang=zh-hans>
<head>
<meta charset=utf-8>
<meta name=viewport content="width=device-width,initial-scale=1">
<meta http-equiv=x-ua-compatible content="IE=edge">
<meta name=author content="小李刀刀">
<meta name=description content="安装 可以通过 composer 安装此扩展： $ composer require spiral/scaffolder 然后确认在你的 App 类中加入 Spiral\Scaffolder\Boot\Bootloader\ScaffolderBootloader: use Spiral\Scaffolder\Bootloader\ScaffolderBootloader; class App extends Kernel { // ... protected const APP = [ // ... ScaffolderBootloader::class ]; } 注意，此扩展会调用 TokenizerConfig, 所以请把它添加到 bootload 链的最后。 配置 您可以使用 scaffolder 配置文件（app/config/scaffolder.php）替换声明生成器及其选项，从而自定义 scaffolder 组件。 默认配置位于可">
<meta name=theme-color content="#3f51b5">
<link rel=stylesheet href=https://cdnjs.cloudflare.com/ajax/libs/academicons/1.8.6/css/academicons.min.css integrity="sha256-uFVgMKfistnJAfoCUQigIl+JfUaP47GrRKjf6CTPVmw=" crossorigin=anonymous>
<link rel=stylesheet href=https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-1/css/all.min.css integrity="sha256-4w9DunooKSr3MFXHXWyFER38WmPdm361bQS/2KUWZbU=" crossorigin=anonymous>
<link rel=stylesheet href=https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css integrity="sha256-Vzbj7sDDS/woiFS3uNKo8eIuni59rjyNGtXfstRzStA=" crossorigin=anonymous>
<link rel=stylesheet href=https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/styles/tomorrow-night.min.css crossorigin=anonymous title=hl-light>
<link rel=stylesheet href=https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/styles/tomorrow-night.min.css crossorigin=anonymous title=hl-dark disabled>
<script src=https://cdnjs.cloudflare.com/ajax/libs/lazysizes/5.1.2/lazysizes.min.js integrity="sha256-Md1qLToewPeKjfAHU1zyPwOutccPAm5tahnaw7Osw0A=" crossorigin=anonymous async></script>
<link rel=stylesheet href="https://fonts.font.im/css?family=Source+Code+Pro:300,400,500,600,700&subset=latin-ext&display=swap">
<link rel=stylesheet href=/css/academic.css>
<script>(function(b,d,e,a,g){b[a]=b[a]||[],b[a].push({'gtm.start':(new Date).getTime(),event:'gtm.js'});var f=d.getElementsByTagName(e)[0],c=d.createElement(e),h=a!='dataLayer'?'&l='+a:'';c.async=!0,c.src='https://www.googletagmanager.com/gtm.js?id='+g+h,f.parentNode.insertBefore(c,f)})(window,document,'script','dataLayer','GTM-5KZH8N7')</script>
<link rel=manifest href=/index.webmanifest>
<link rel=icon type=image/png href=/images/icon_hu0b7a4cb9992c9ac0e91bd28ffd38dd00_9727_32x32_fill_lanczos_center_3.png>
<link rel=apple-touch-icon type=image/png href=/images/icon_hu0b7a4cb9992c9ac0e91bd28ffd38dd00_9727_192x192_fill_lanczos_center_3.png>
<link rel=canonical href=https://studyspiral.cn/docs/basics/scaffolding/>
<meta property="twitter:card" content="summary">
<meta property="og:site_name" content="Spiral中文网">
<meta property="og:url" content="https://studyspiral.cn/docs/basics/scaffolding/">
<meta property="og:title" content="脚手架 | Spiral中文网">
<meta property="og:description" content="安装 可以通过 composer 安装此扩展： $ composer require spiral/scaffolder 然后确认在你的 App 类中加入 Spiral\Scaffolder\Boot\Bootloader\ScaffolderBootloader: use Spiral\Scaffolder\Bootloader\ScaffolderBootloader; class App extends Kernel { // ... protected const APP = [ // ... ScaffolderBootloader::class ]; } 注意，此扩展会调用 TokenizerConfig, 所以请把它添加到 bootload 链的最后。 配置 您可以使用 scaffolder 配置文件（app/config/scaffolder.php）替换声明生成器及其选项，从而自定义 scaffolder 组件。 默认配置位于可"><meta property="og:image" content="https://studyspiral.cn/images/logo.svg">
<meta property="twitter:image" content="https://studyspiral.cn/images/logo.svg"><meta property="og:locale" content="zh-Hans">
<meta property="article:published_time" content="2020-02-28T17:08:00+08:00">
<meta property="article:modified_time" content="2020-04-13T00:00:42+08:00">
<script src=https://cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.1/cookieconsent.min.js integrity="sha256-5VhCqFam2Cn+yjw61zbBNrbHVJ6SRydPeKopYlngbiQ=" crossorigin=anonymous></script>
<link rel=stylesheet href=https://cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.1/cookieconsent.min.css integrity="sha256-zQ0LblD/Af8vOppw18+2anxsuaz3pWYyVWi+bTvTH8Q=" crossorigin=anonymous>
<script>window.addEventListener("load",function(){window.cookieconsent.initialise({palette:{popup:{background:"#3f51b5",text:"#fff"},button:{background:"#fff",text:"#3f51b5"}},theme:"classic",content:{message:"本网站使用cookies来确保您在本网站上获得最佳体验。",dismiss:"知道了!",link:"了解更多",href:"https://www.cookiesandyou.com"}})})</script>
<title>脚手架 | Spiral中文网</title>
</head>
<body id=top data-spy=scroll data-offset=70 data-target=#TableOfContents>
<aside class=search-results id=search>
<div class=container>
<section class=search-header>
<div class="row no-gutters justify-content-between mb-3">
<div class=col-6>
<h1>搜索</h1>
</div>
<div class="col-6 col-search-close">
<a class=js-search href=#><i class="fas fa-times-circle text-muted" aria-hidden=true></i></a>
</div>
</div>
<div id=search-box>
<input name=q id=search-query placeholder=搜索... autocapitalize=off autocomplete=off autocorrect=off spellcheck=false type=search>
</div>
</section>
<section class=section-search-results>
<div id=search-hits>
</div>
</section>
</div>
</aside>
<nav class="navbar navbar-expand-lg navbar-light compensate-for-scrollbar" id=navbar-main>
<div class=container>
<div class="d-none d-lg-inline-flex">
<a class=navbar-brand href=/><img src=/images/logo.svg alt=Spiral中文网>Spiral中文网</a>
</div>
<button type=button class=navbar-toggler data-toggle=collapse data-target=#navbar-content aria-controls=navbar aria-expanded=false aria-label=切换导航>
<span><i class="fas fa-bars"></i></span>
</button>
<div class="navbar-brand-mobile-wrapper d-inline-flex d-lg-none">
<a class=navbar-brand href=/><img src=/images/logo.svg alt=Spiral中文网>Spiral中文网</a>
</div>
<div class="navbar-collapse main-menu-item collapse justify-content-end" id=navbar-content>
<ul class="navbar-nav d-md-inline-flex">
<li class=nav-item>
<a class=nav-link href=/docs/basics/quick-start/><span>教程</span></a>
</li>
<li class=nav-item>
<a class="nav-link active" href=/docs/><span>文档</span></a>
</li>
<li class=nav-item>
<a class=nav-link href=/post/><span>文章</span></a>
</li>
</ul>
</div>
<ul class="nav-icons navbar-nav flex-row ml-auto d-flex pl-md-2">
<li class=nav-item>
<a class="nav-link js-search" href=#><i class="fas fa-search" aria-hidden=true></i></a>
</li>
</ul>
</div>
</nav>
<div class="container-fluid docs">
<div class="row flex-xl-nowrap">
<div class="col-12 col-md-3 col-xl-2 docs-sidebar">
<form class="docs-search d-flex align-items-center">
<button class="btn docs-toggle d-md-none p-0 mr-3" type=button data-toggle=collapse data-target=#docs-nav aria-controls=docs-nav aria-expanded=false aria-label="Toggle section navigation">
<span><i class="fas fa-bars"></i></span>
</button>
<input name=q type=search class=form-control placeholder=搜索... autocomplete=off>
</form>
<nav class="collapse docs-links" id=docs-nav>
<div class=docs-toc-item>
<a class=docs-toc-link href=/docs/extension/dotenv/>Dotenv</a>
</div>
<div class=docs-toc-item>
<a class=docs-toc-link href=/docs/>总览</a>
<ul class="nav docs-sidenav docs-sidenav-sub collapse show">
<li>
<a href=/docs/>Spiral介绍</a>
</li>
<li>
<a href=/docs/about/contributing/>贡献指引</a>
</li>
<li>
<a href=/docs/about/semver/>版本说明</a>
</li>
<li>
<a href=/docs/about/license/>授权协议</a>
</li>
</ul>
</div>
<div class=docs-toc-item>
<a class=docs-toc-link href=/docs/http/psr-15/>定制 PSR-15 处理器</a>
</div>
<div class=docs-toc-item>
<a class=docs-toc-link href=/docs/start/install/>快速开始</a>
<ul class="nav docs-sidenav docs-sidenav-sub collapse">
<li>
<a href=/docs/start/install/>安装指引</a>
</li>
<li>
<a href=/docs/start/workers/>应用工作进程</a>
</li>
<li>
<a href=/docs/start/structure/>应用程序结构</a>
</li>
<li>
<a href=/docs/start/configuration/>默认配置</a>
</li>
<li>
<a href=/docs/start/commands/>控制台命令</a>
</li>
</ul>
</div>
<div class=docs-toc-item>
<a class=docs-toc-link href=/docs/basics/quick-start/>入门基础</a>
<ul class="nav docs-sidenav docs-sidenav-sub collapse show">
<li>
<a href=/docs/basics/quick-start/>上手指南</a>
</li>
<li class=active>
<a href=/docs/basics/scaffolding/>脚手架</a>
</li>
<li>
<a href=/docs/basics/prototype/>原型开发辅助</a>
</li>
</ul>
</div>
<div class=docs-toc-item>
<a class=docs-toc-link href=/docs/framework/design/>核心框架</a>
<ul class="nav docs-sidenav docs-sidenav-sub collapse">
<li>
<a href=/docs/framework/design/>设计理念</a>
</li>
<li>
<a href=/docs/framework/application-server/>应用服务器</a>
</li>
<li>
<a href=/docs/framework/config/>配置对象</a>
</li>
<li>
<a href=/docs/framework/kernel/>内核与环境</a>
</li>
<li>
<a href=/docs/framework/container/>容器</a>
</li>
<li>
<a href=/docs/framework/bootloaders/>引导程序</a>
</li>
<li>
<a href=/docs/framework/scopes/>IoC 作用域</a>
</li>
<li>
<a href=/docs/framework/memory/>静态高速缓存</a>
</li>
<li>
<a href=/docs/framework/finalizers/>终结器</a>
</li>
</ul>
</div>
<div class=docs-toc-item>
<a class=docs-toc-link href=/docs/cookbook/annotated-routes/>速查手册</a>
<ul class="nav docs-sidenav docs-sidenav-sub collapse">
<li>
<a href=/docs/cookbook/annotated-routes/>注解式路由</a>
</li>
<li>
<a href=/docs/cookbook/injector/>容器注入器</a>
</li>
<li>
<a href=/docs/cookbook/domain-core/>领域内核、控制器</a>
</li>
<li>
<a href=/docs/cookbook/golang-library/>Golang服务集成</a>
</li>
<li>
<a href=/docs/cookbook/custom-dispatcher/>自定义调度器</a>
</li>
</ul>
</div>
<div class=docs-toc-item>
<a class=docs-toc-link href=/docs/component/files/>常用组件</a>
<ul class="nav docs-sidenav docs-sidenav-sub collapse">
<li>
<a href=/docs/component/files/>文件和目录</a>
</li>
<li>
<a href=/docs/component/reactor/>代码生成</a>
</li>
<li>
<a href=/docs/component/tokenizer/>静态分析工具</a>
</li>
<li>
<a href=/docs/component/metrics/>应用指标</a>
</li>
<li>
<a href=/docs/component/data-grid/>数据网格</a>
</li>
</ul>
</div>
<div class=docs-toc-item>
<a class=docs-toc-link href=/docs/console/configuration/>控制台</a>
<ul class="nav docs-sidenav docs-sidenav-sub collapse">
<li>
<a href=/docs/console/configuration/>安装和配置</a>
</li>
<li>
<a href=/docs/console/commands/>用户命令</a>
</li>
</ul>
</div>
<div class=docs-toc-item>
<a class=docs-toc-link href=/docs/http/configuration/>HTTP</a>
<ul class="nav docs-sidenav docs-sidenav-sub collapse">
<li>
<a href=/docs/http/configuration/>安装配置</a>
</li>
<li>
<a href=/docs/http/lifecycle/>请求生命周期</a>
</li>
<li>
<a href=/docs/http/request-response/>请求和响应</a>
</li>
<li>
<a href=/docs/http/routing/>路由</a>
</li>
<li>
<a href=/docs/http/errors/>错误页面</a>
</li>
<li>
<a href=/docs/http/middleware/>中间件</a>
</li>
<li>
<a href=/docs/http/golang/>Golang 中间件</a>
</li>
<li>
<a href=/docs/http/cookies/>Cookies</a>
</li>
<li>
<a href=/docs/http/session/>Session</a>
</li>
<li>
<a href=/docs/http/csrf/>CSRF 防护</a>
</li>
</ul>
</div>
<div class=docs-toc-item>
<a class=docs-toc-link href=/docs/security/encrypter/>安全</a>
<ul class="nav docs-sidenav docs-sidenav-sub collapse">
<li>
<a href=/docs/security/encrypter/>数据加密</a>
</li>
<li>
<a href=/docs/security/validation/>数据验证</a>
</li>
<li>
<a href=/docs/security/rbac/>基于角色的权限控制</a>
</li>
<li>
<a href=/docs/security/authentication/>用户认证</a>
</li>
</ul>
</div>
<div class=docs-toc-item>
<a class=docs-toc-link href=/docs/filters/configuration/>请求过滤</a>
<ul class="nav docs-sidenav docs-sidenav-sub collapse">
<li>
<a href=/docs/filters/configuration/>安装和配置</a>
</li>
<li>
<a href=/docs/filters/filter/>过滤器</a>
</li>
<li>
<a href=/docs/filters/composite/>复合过滤器</a>
</li>
</ul>
</div>
<div class=docs-toc-item>
<a class=docs-toc-link href=/docs/database/configuration/>数据库</a>
<ul class="nav docs-sidenav docs-sidenav-sub collapse">
<li>
<a href=/docs/database/configuration/>安装与配置</a>
</li>
<li>
<a href=/docs/database/access/>访问数据</a>
</li>
<li>
<a href=/docs/database/isolation/>逻辑隔离</a>
</li>
<li>
<a href=/docs/database/query-builders/>查询构造器</a>
</li>
<li>
<a href=/docs/database/transactions/>Transactions</a>
</li>
<li>
<a href=/docs/database/introspection/>Schema Introspection</a>
</li>
<li>
<a href=/docs/database/declaration/>Declaration</a>
</li>
<li>
<a href=/docs/database/migrations/>Migrations</a>
</li>
<li>
<a href=/docs/database/errata/>Errata</a>
</li>
</ul>
</div>
<div class=docs-toc-item>
<a class=docs-toc-link href=/docs/cycle/configuration/>Cycle ORM</a>
<ul class="nav docs-sidenav docs-sidenav-sub collapse">
<li>
<a href=/docs/cycle/configuration/>Configuration</a>
</li>
</ul>
</div>
<div class=docs-toc-item>
<a class=docs-toc-link href=/docs/queue/configuration/>队列任务</a>
<ul class="nav docs-sidenav docs-sidenav-sub collapse">
<li>
<a href=/docs/queue/configuration/>Configuration</a>
</li>
<li>
<a href=/docs/queue/scraper/>网站爬虫</a>
</li>
</ul>
</div>
<div class=docs-toc-item>
<a class=docs-toc-link href=/docs/views/configuration/>视图</a>
<ul class="nav docs-sidenav docs-sidenav-sub collapse">
<li>
<a href=/docs/views/configuration/>Configuration</a>
</li>
</ul>
</div>
<div class=docs-toc-item>
<a class=docs-toc-link href=/docs/stempler/configuration/>Stempler 模板</a>
<ul class="nav docs-sidenav docs-sidenav-sub collapse">
<li>
<a href=/docs/stempler/configuration/>Configuration</a>
</li>
<li>
<a href=/docs/stempler/directives/>Directives</a>
</li>
</ul>
</div>
<div class=docs-toc-item>
<a class=docs-toc-link>国际化</a>
</div>
<div class=docs-toc-item>
<a class=docs-toc-link>GRPC</a>
</div>
<div class=docs-toc-item>
<a class=docs-toc-link>事件广播</a>
</div>
<div class=docs-toc-item>
<a class=docs-toc-link>调试及性能</a>
</div>
<div class=docs-toc-item>
<a class=docs-toc-link>扩展</a>
</div>
</nav>
</div>
<div class="d-none d-xl-block col-xl-2 docs-toc">
<ul class="nav toc-top">
<li><a href=# id=back_to_top class=docs-toc-title>在本页</a></li>
</ul>
<nav id=TableOfContents>
<ul>
<li><a href=#安装>安装</a></li>
<li><a href=#配置>配置</a></li>
<li><a href=#可用命令>可用命令</a>
<ul>
<li><a href=#创建引导程序类>创建引导程序类</a></li>
<li><a href=#创建命令>创建命令</a></li>
<li><a href=#创建配置类>创建配置类</a></li>
<li><a href=#创建控制器>创建控制器</a></li>
<li><a href=#创建-http-请求过滤器>创建 HTTP 请求过滤器</a></li>
<li><a href=#创建任务处理器>创建任务处理器</a></li>
<li><a href=#创建中间件>创建中间件</a></li>
<li><a href=#创建数据库迁移>创建数据库迁移</a></li>
<li><a href=#创建实体仓库>创建实体仓库</a></li>
<li><a href=#创建-orm-实体>创建 ORM 实体</a></li>
</ul>
</li>
</ul>
</nav>
</div>
<main class="col-12 col-md-9 col-xl-8 py-md-3 pl-md-5 docs-content" role=main>
<article class=article>
<div class="alert alert-warning" role=alert>
官方文档中文版翻译工作仍在进行中，欢迎 <a href=/post/join-translation/>参与翻译</a>。
</div>
<div class=docs-article-container>
<h1>脚手架</h1>
<div class=article-style>
<h2 id=安装>安装</h2>
<p>可以通过 composer 安装此扩展：</p>
<pre><code class=language-bash>$ composer require spiral/scaffolder
</code></pre>
<p>然后确认在你的 App 类中加入 <code>Spiral\Scaffolder\Boot\Bootloader\ScaffolderBootloader</code>:</p>
<pre><code class=language-php>use Spiral\Scaffolder\Bootloader\ScaffolderBootloader;

class App extends Kernel
{
    // ...

    protected const APP = [
        // ...
        ScaffolderBootloader::class
    ];
}
</code></pre>
<blockquote>
<p>注意，此扩展会调用 <code>TokenizerConfig</code>, 所以请把它添加到 bootload 链的最后。</p>
</blockquote>
<h2 id=配置>配置</h2>
<p>您可以使用 <code>scaffolder</code> 配置文件（<code>app/config/scaffolder.php</code>）替换声明生成器及其选项，从而自定义 scaffolder 组件。
默认配置位于可以在 <code>ScaffolderBootloader</code> 中找到。</p>
<h2 id=可用命令>可用命令</h2>
<table>
<thead>
<tr>
<th>命令</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>create:bootloader</td>
<td>创建引导程序</td>
</tr>
<tr>
<td>create:command</td>
<td>创建命令</td>
</tr>
<tr>
<td>create:config</td>
<td>创建配置类</td>
</tr>
<tr>
<td>create:controller</td>
<td>创建控制器</td>
</tr>
<tr>
<td>create:filter</td>
<td>创建 HTTP 请求过滤器</td>
</tr>
<tr>
<td>create:jobHandler</td>
<td>创建任务处理器</td>
</tr>
<tr>
<td>create:middleware</td>
<td>创建中间件</td>
</tr>
<tr>
<td>create:migration</td>
<td>创建数据库迁移</td>
</tr>
<tr>
<td>create:repository</td>
<td>创建实体仓库</td>
</tr>
<tr>
<td>create:entity</td>
<td>创建实体</td>
</tr>
</tbody>
</table>
<h3 id=创建引导程序类>创建引导程序类</h3>
<pre><code class=language-bash>$ php app.php create:bootloader &lt;name&gt;
</code></pre>
<p>此命令会创建名为 <code>&lt;Name>Bootloader</code> 的类。</p>
<h4 id=示例>示例</h4>
<pre><code class=language-bash>$ php app.php create:bootloader my
</code></pre>
<p>创建的类（<code>&lt;app directory>\src\Bootloader\MyBootloader.php</code>）代码如下：</p>
<pre><code class=language-php>use Spiral\Boot\Bootloader\Bootloader;

class MyBootloader extends Bootloader
{
    protected const BINDINGS = [];

    protected const SINGLETONS = [];

    protected const DEPENDENCIES = [];

    public function boot(): void
    {
    }
}
</code></pre>
<h3 id=创建命令>创建命令</h3>
<pre><code class=language-bash>$ php app.php create:command &lt;name&gt; [alias]
</code></pre>
<p>此命令会创建 <code>&lt;Name>Command</code> 类。命令的执行名称是 <code>name</code> 或者 <code>alias</code>(如果指定).</p>
<h4 id=不指定-alias-的示例>不指定 <code>alias</code> 的示例</h4>
<pre><code class=language-bash>$ php app.php create:bootloader my
</code></pre>
<p>生成的类（<code>&lt;app directory>\src\Command\MyCommand.php</code>）代码如下</p>
<pre><code class=language-php>use Spiral\Console\Command;

class MyCommand extends Command
{
    protected const NAME = 'my';

    protected const DESCRIPTION = '';

    protected const ARGUMENTS = [];

    protected const OPTIONS = [];

    /**
     * Perform command
     */
    protected function perform(): void
    {
    }
}
</code></pre>
<h4 id=指定-alias-的示例>指定 <code>alias</code> 的示例：</h4>
<pre><code class=language-bash>$ php app.php create:bootloader my alias
</code></pre>
<p>生成的类（<code>&lt;app directory>\src\Command\MyCommand.php</code>）代码如下</p>
<pre><code class=language-php>use Spiral\Console\Command;

class MyCommand extends Command
{
    protected const NAME = 'alias';

    protected const DESCRIPTION = '';

    protected const ARGUMENTS = [];

    protected const OPTIONS = [];

    /**
     * Perform command
     */
    protected function perform(): void
    {
    }
}
</code></pre>
<h3 id=创建配置类>创建配置类</h3>
<pre><code class=language-bash>$ php app.php create:config &lt;name&gt;
</code></pre>
<p>此命令会创建名为 <code>&lt;Name>Config</code> 的类。同时，如果对应的配置文件 <code>&lt;app directory>/config/&lt;name>.php</code> 不存在的话，也会自动创建。</p>
<p>可用选项:</p>
<ul>
<li><code>--reverse (-r)</code> - 指定此标志时, 脚手架会查找 <code>&lt;app directory>/config/&lt;name>.php</code> 文件并基于该文件创建对应的 <code>&lt;Name>Config</code> 类。
生成的类会包含默认值和 getters, 有时它还会为数组生成 by-key-getters.</li>
</ul>
<p>具体如下：</p>
<p>如果数值值包含有多个子值，且所有子值的具有相同类型的键和值时，脚手架会尝试创建 by-key-getter 方法。
如果要生成的方法名称已经存在，by-key-getter 不会创建。</p>
<h4 id=空配置文件示例>空配置文件示例：</h4>
<pre><code class=language-bash>$ php app.php create:config my
</code></pre>
<p>生成的配置文件（<code>&lt;app directory>/config/MyConfig.php</code>）代码如下：</p>
<pre><code class=language-php>return [];
</code></pre>
<p>生成的类（<code>&lt;app directory>/src/Config/MyConfig.php</code>）代码如下：</p>
<pre><code class=language-php>use Spiral\Core\InjectableConfig;

class MyConfig extends InjectableConfig
{
    public const CONFIG = 'my';

    /**
     * @internal For internal usage. Will be hydrated in the constructor.
     */
    protected $config = [];
}
</code></pre>
<h4 id=反向生成示例>反向生成示例</h4>
<pre><code class=language-php>//...存在的 &quot;my.php&quot; 配置文件：
return [
    //将会创建 &quot;getParam()&quot; by-key-getter 方法（单数名称转换成功）
    'params'      =&gt; [
        'one' =&gt; 'param',
        'two' =&gt; 'another param',
    ],
    //将会创建 &quot;getParameterBy()&quot; by-key-getter 方法（单数名称转换不成功）
    'parameter'   =&gt; [
        'one' =&gt; 'parameter',
        'two' =&gt; 'another parameter',
    ],
    //将会创建 &quot;getValueBy()&quot; by-key-getter 方法（因为 &quot;getValue()&quot; 会与下面的 &quot;value&quot; 字段冲突)
    'values'      =&gt; [
        1 =&gt; 'value',
        2 =&gt; 'another value',
    ],
    'value'       =&gt; 'third value',
    //不会创建 by-key-getter 方法，因为只有一个子值
    'few'        =&gt; [
        'one' =&gt; 'value',
    ],
    //不会创建 by-key-getter 方法，因为有不同类型的子值
    'mixedValues' =&gt; [
        'one' =&gt; 'value',
        'two' =&gt; 2,
    ],
    //不会创建 by-key-getter 方法，因为有不同类型的子健
    'mixedKeys'   =&gt; [
        'one' =&gt; 'value',
        2     =&gt; 'another value',
    ],
    //不会创建 by-key-getter 方法
    //（因为 &quot;getConflict()&quot; 和 &quot;getConflictBy()&quot; 分别已经被接下来的 &quot;conflict&quot; 和 &quot;conflictBy&quot; 字段占用）
    'conflicts'   =&gt; [
        'one' =&gt; 'conflict',
        'two' =&gt; 'another conflict',
    ],
    'conflict'    =&gt; 'third conflic',
    'conflictBy'  =&gt; 'fourth conflic',
];
</code></pre>
<pre><code class=language-bash>$ php app.php create:config my -r
</code></pre>
<p>生成的类（<code>&lt;app directory>/src/Config/MyConfig.php</code>）代码如下：</p>
<pre><code class=language-php>use Spiral\Core\InjectableConfig;

class MyConfig extends InjectableConfig
{
    public const CONFIG = 'my';

    /**
     * @internal For internal usage. Will be hydrated in the constructor.
     */
    protected $config = [
        'params'      =&gt; [],
        'parameter'   =&gt; [],
        'values'      =&gt; [],
        'value'       =&gt; '',
        'few'         =&gt; [],
        'mixedValues' =&gt; [],
        'mixedKeys'   =&gt; [],
        'conflicts'   =&gt; [],
        'conflict'    =&gt; '',
        'conflictBy'  =&gt; ''
    ];

    /**
     * @return array|string[]
     */
    public function getParams(): array
    {
        return $this-&gt;config['params'];
    }

    /**
     * @return array|string[]
     */
    public function getParameter(): array
    {
        return $this-&gt;config['parameter'];
    }

    /**
     * @return array|string[]
     */
    public function getValues(): array
    {
        return $this-&gt;config['values'];
    }

    /**
     * @return string
     */
    public function getValue(): string
    {
        return $this-&gt;config['value'];
    }

    /**
     * @return array|string[]
     */
    public function getFew(): array
    {
        return $this-&gt;config['few'];
    }

    /**
     * @return array
     */
    public function getMixedValues(): array
    {
        return $this-&gt;config['mixedValues'];
    }

    /**
     * @return array|string[]
     */
    public function getMixedKeys(): array
    {
        return $this-&gt;config['mixedKeys'];
    }

    /**
     * @return array|string[]
     */
    public function getConflicts(): array
    {
        return $this-&gt;config['conflicts'];
    }

    /**
     * @return string
     */
    public function getConflict(): string
    {
        return $this-&gt;config['conflict'];
    }

    /**
     * @return string
     */
    public function getConflictBy(): string
    {
        return $this-&gt;config['conflictBy'];
    }

    /**
     * @param string param
     * @return string
     */
    public function getParam(string $param): string
    {
        return $this-&gt;config['params'][$param];
    }

    /**
     * @param string parameter
     * @return string
     */
    public function getParameterBy(string $parameter): string
    {
        return $this-&gt;config['parameter'][$parameter];
    }

    /**
     * @param int value
     * @return string
     */
    public function getValueBy(int $value): string
    {
        return $this-&gt;config['values'][$value];
    }
}
</code></pre>
<h3 id=创建控制器>创建控制器</h3>
<pre><code class=language-bash>$ php app.php create:controller &lt;name&gt;
</code></pre>
<p>此命令会创建名为 <code>&lt;Name>Controller</code> 的类。 可用选项：</p>
<ul>
<li><code>--action (-a)</code> (允许多次使用) - 用此选项添加 action 方法</li>
<li><code>--prototype (-p)</code> - 如果指定此标志，会添加 <code>PrototypeTrait</code></li>
</ul>
<h4 id=不添加-action-的示例>不添加 action 的示例：</h4>
<pre><code class=language-bash>$ php app.php create:controller my
</code></pre>
<p>生成的类（<code>&lt;app directory>/src/Controller/MyController.php</code>）代码如下：</p>
<pre><code class=language-php>class MyController
{
}
</code></pre>
<h4 id=使用---prototype-标志的示例>使用 <code>--prototype</code> 标志的示例：</h4>
<pre><code class=language-bash>$ php app.php create:controller my -p
</code></pre>
<p>生成的类（<code>&lt;app directory>/src/Controller/MyController.php</code>）代码如下：</p>
<pre><code class=language-php>use Spiral\Prototype\Traits\PrototypeTrait;

class MyController
{
    use PrototypeTrait;
}
</code></pre>
<h4 id=包含-action-方法的示例>包含 action 方法的示例：</h4>
<pre><code class=language-bash>$ php app.php create:controller my -a index -a create -a update -a delete
</code></pre>
<p>生成的类（<code>&lt;app directory>/src/Controller/MyController.php</code>）代码如下：</p>
<pre><code class=language-php>class MyController
{
    public function index()
    {
    }

    public function create()
    {
    }

    public function update()
    {
    }

    public function delete()
    {
    }
}
</code></pre>
<h3 id=创建-http-请求过滤器>创建 HTTP 请求过滤器</h3>
<pre><code class=language-bash>$ php app.php create:filter &lt;name&gt;
</code></pre>
<p>此命令会创建名为 <code>&lt;Name>Filter</code> 的类。可用选项：</p>
<ul>
<li><code>--entity (-e)</code> - 你可以指定实体类 <code>EntityClass</code>, 过滤器生成器会取出指定实体类的所有属性，放入生成的过滤器
并尝试根据每个属性的类型声明(php7.4)、默认值或者 PhpDoc 定义它的类型。或者你也可以用 <code>field</code> 选项指定过滤器的模式（Schema）。</li>
<li><code>--field (-f)</code> -（可以多次使用）。完整的字段格式是 <code>name:type(source:origin)</code>.
<code>type</code>, <code>origin</code> 和 <code>source:origin</code> 是可选的，可以省略，默认值如下：
<ul>
<li>type=string</li>
<li>source={data}</li>
</ul>
</li>
</ul>
<blockquote>
<p>了解更多有关过滤器的信息，可以查看
<a href=https://github.com/spiral/filters target=_blank rel=noopener>filters</a> 组件包</p>
</blockquote>
<h4 id=不含字段定义的示例>不含字段定义的示例：</h4>
<pre><code class=language-bash>$ php app.php create:filter my
</code></pre>
<p>生成的类（<code>&lt;app directory>/src/Filter/MyFilter.php</code>）代码如下：</p>
<pre><code class=language-php>use Spiral\Filters\Filter;

class MyFilter extends Filter
{
    protected const SCHEMA = [];

    protected const VALIDATES = [];

    protected const SETTERS = [];
}
</code></pre>
<h4 id=包含字段定义的示例>包含字段定义的示例：</h4>
<pre><code class=language-bash>$ php app.php create:filter my -f unknown_val -f str_val:string -f int_val:int -f bool_val:bool(query:from_bool) -f float_val:float(query)
</code></pre>
<p>生成的类（<code>&lt;app directory>/src/Filter/MyFilter.php</code>）代码如下：</p>
<pre><code class=language-php>use Spiral\Filters\Filter;

class MyFilter extends Filter
{
    protected const SCHEMA = [
        'unknown_val' =&gt; 'data:unknown_val',
        'str_val'     =&gt; 'data:str_val',
        'int_val'     =&gt; 'data:int_val',
        'bool_val'    =&gt; 'query:from_bool',
        'float_val'   =&gt; 'query:float_val'
    ];

    protected const VALIDATES = [
        'unknown_val' =&gt; [
            'notEmpty',
            'string'
        ],
        'str_val'     =&gt; [
            'notEmpty',
            'string'
        ],
        'int_val'     =&gt; [
            'notEmpty',
            'integer'
        ],
        'bool_val'    =&gt; [
            'notEmpty',
            'boolean'
        ],
        'float_val'   =&gt; [
            'notEmpty',
            'float'
        ]
    ];

    protected const SETTERS = [];
}
</code></pre>
<h4 id=指定实体源的示例>指定实体源的示例：</h4>
<pre><code class=language-php>//...已经存在的 &quot;MyEntity&quot; 实体类：
class MyEntity
{
    protected bool $typedBool;

    public $noTypeString;

    /** @var SomeOtherEntity */
    public $obj;

    /** @var int */
    protected $intFromPhpDoc;

    private $noTypeWithFloatDefault = 1.1;
}
</code></pre>
<pre><code class=language-bash>$ php app.php create:filter my -e MyEntity
</code></pre>
<p>生成的类（<code>&lt;app directory>/src/Filter/MyFilter.php</code>）代码如下：</p>
<pre><code class=language-php>use Spiral\Filters\Filter;

class MyFilter extends Filter
{
    protected const SCHEMA = [
        'typedBool'              =&gt; 'data:typedBool',
        'noTypeString'           =&gt; 'data:noTypeString',
        'obj'                    =&gt; 'data:obj',
        'intFromPhpDoc'          =&gt; 'data:intFromPhpDoc',
        'noTypeWithFloatDefault' =&gt; 'data:noTypeWithFloatDefault'
    ];

    protected const VALIDATES = [
        'typedBool'              =&gt; [
            'notEmpty',
            'boolean'
        ],
        'noTypeString'           =&gt; [
            'notEmpty',
            'string'
        ],
        'obj'                    =&gt; [
            'notEmpty',
            'string'
        ],
        'intFromPhpDoc'          =&gt; [
            'notEmpty',
            'integer'
        ],
        'noTypeWithFloatDefault' =&gt; [
            'notEmpty',
            'float'
        ]
    ];

    protected const SETTERS = [];
}
</code></pre>
<h3 id=创建任务处理器>创建任务处理器</h3>
<pre><code class=language-bash>$ php app.php create:jobHandler &lt;name&gt;
</code></pre>
<p>此命令会创建名为 <code>&lt;Name>Job</code> 的类。</p>
<h4 id=示例-1>示例：</h4>
<pre><code class=language-bash>$ php app.php create:jobHandler my
</code></pre>
<p>生成的类（<code>&lt;app directory>/src/Job/MyJob.php</code>）代码如下：</p>
<pre><code class=language-php>use Spiral\Jobs\JobHandler;

class MyJob extends JobHandler
{
    public function invoke(): void
    {
    }
}
</code></pre>
<h3 id=创建中间件>创建中间件</h3>
<pre><code class=language-bash>$ php app.php create:middleware &lt;name&gt;
</code></pre>
<p>此命令会创建名为 <code>&lt;Name></code> 的类。</p>
<h4 id=示例-2>示例：</h4>
<pre><code class=language-bash>$ php app.php create:middleware my
</code></pre>
<p>生成的类（<code>&lt;app directory>/src/Middleware/My.php</code>）代码如下：</p>
<pre><code class=language-php>use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;

class My implements MiddlewareInterface
{
    /**
     * {@inheritdoc}
     */
    public function process(Request $request, RequestHandlerInterface $handler): Response
    {
        return $handler-&gt;handle($request);
    }
}
</code></pre>
<h3 id=创建数据库迁移>创建数据库迁移</h3>
<pre><code class=language-bash>$ php app.php create:migration &lt;name&gt;
</code></pre>
<p>此命令会生成名为 <code>&lt;Name>Migration</code> 的类。可用选项：</p>
<ul>
<li><code>--table (-t)</code> 指定数据库表名</li>
<li><code>--column (-c)</code> -（可以多次使用） 指定列定义。指定表名时才可用。列格式是 <code>name:type</code>.</li>
</ul>
<blockquote>
<p>关于数据库迁移的更多信息，请查看
<a href=https://github.com/spiral/migrations target=_blank rel=noopener>migrations</a> 组件包</p>
</blockquote>
<h4 id=示例-3>示例</h4>
<pre><code class=language-bash>$ php app.php create:migration my
</code></pre>
<p>生成的类（<code>&lt;app directory>/src/migrations/&lt;date>.&lt;time>-&lt;index>-my.php</code>）代码如下：</p>
<pre><code class=language-php>use Spiral\Migrations\Migration;

class MyMigration extends Migration
{
    /**
     * Create tables, add columns or insert data here
     */
    public function up(): void
    {
    }

    /**
     * Drop created, columns and etc here
     */
    public function down(): void
    {
    }
}
</code></pre>
<h4 id=待选项的示例>待选项的示例</h4>
<pre><code class=language-bash>$ php app.php create:migration my -t my_table -c int_col:int
</code></pre>
<p>生成的类（<code>&lt;app directory>/migrations/&lt;date>.&lt;time>-&lt;index>-my.php</code>）代码如下：</p>
<pre><code class=language-php>use Spiral\Migrations\Migration;

class MyMigration extends Migration
{
    /**
     * Create tables, add columns or insert data here
     */
    public function up(): void
    {
        $this-&gt;table('my_table')
            -&gt;addColumn('int_col', 'int')
            -&gt;create();
    }

    /**
     * Drop created, columns and etc here
     */
    public function down(): void
    {
        $this-&gt;table('my_table')-&gt;drop();
    }
}
</code></pre>
<h3 id=创建实体仓库>创建实体仓库</h3>
<pre><code class=language-bash>$ php app.php create:repository &lt;name&gt;
</code></pre>
<p>此命令会创建名为 <code>&lt;Name>Repository</code> 的类。</p>
<h4 id=示例-4>示例：</h4>
<pre><code class=language-bash>$ php app.php create:repository my
</code></pre>
<p>生成的类（<code>&lt;app directory>/src/Repository/MyRepository.php</code>）代码如下：</p>
<pre><code class=language-php>use Cycle\ORM\Select\Repository;

class MyRepository extends Repository
{
}
</code></pre>
<h3 id=创建-orm-实体>创建 ORM 实体</h3>
<pre><code class=language-bash>$ php app.php create:entity &lt;name&gt; [&lt;format&gt;]
</code></pre>
<p>此命令会创建名为 <code>&lt;Name>Entity</code> 的类（译注：实测生成的类名是 <code>&lt;Name></code>）。</p>
<p><code>format</code> 负责声明格式, 当前只支持
<a href=https://github.com/cycle/annotated target=_blank rel=noopener>annotations</a> 格式。可用选项：</p>
<ul>
<li><code>--role (-r)</code> - 实体角色，默认为不含命名空间的类名称的小写格式</li>
<li><code>--mapper (-m)</code> - 映射器类名，默认是 <code>Cycle\ORM\Mapper\Mapper</code></li>
<li><code>--table (-t)</code> - 实体的源表，默认是实体角色的复数形式</li>
<li><code>--accessibility (-a)</code> - 属性可访问性（public, protected, private）, 默认为 public</li>
<li><code>--inflection (-i)</code> - 列名变形选项，可用的值有：tableize (t), camelize (c). 参见
<a href=https://github.com/doctrine/inflector target=_blank rel=noopener>Doctrine inflector</a></li>
<li><code>--field (-f)</code> -（允许多次使用）添加一个列，格式为 &ldquo;name:type&rdquo;</li>
<li><code>--repository (-e)</code> - 用于实体的数据读取操作的数据仓库类，默认是 <code>Cycle\ORM\Select\Repository</code></li>
<li><code>--database (-d)</code> - 数据库连接，默认是 null（使用 default 连接）</li>
</ul>
<h4 id=示例-5>示例：</h4>
<pre><code class=language-bash>$ php app.php create:entity my
</code></pre>
<p>生成的类（<code>&lt;app directory>/src/Database/My.php</code>）代码如下：</p>
<pre><code class=language-php>use Cycle\Annotated\Annotation as Cycle;

/**
 * @Cycle\Entity()
 */
class My
{
}
</code></pre>
<h4 id=指定可访问性为-public-的示例>指定可访问性为 public 的示例：</h4>
<pre><code class=language-bash>$ php app.php create:entity my -f field:string
</code></pre>
<p>生成的类（<code>&lt;app directory>/src/Database/My.php</code>）代码如下：</p>
<pre><code class=language-php>use Cycle\Annotated\Annotation as Cycle;

/**
 * @Cycle\Entity()
 */
class My
{
    /**
     * @Cycle\Column(type = &quot;string&quot;)
     */
    public $field;
}
</code></pre>
<h4 id=指定可访问性为-protectedprivate-的示例>指定可访问性为 protected/private 的示例：</h4>
<pre><code class=language-bash>$ php app.php create:entity my -f field:string -a protected
</code></pre>
<p>生成的类（<code>&lt;app directory>/src/Database/My.php</code>）代码如下：</p>
<pre><code class=language-php>
use Cycle\Annotated\Annotation as Cycle;

/**
 * @Cycle\Entity()
 */
class My
{
    /**
     * @Cycle\Column(type = &quot;string&quot;)
     */
    protected $field;

    public function setField(string $value)
    {
        $this-&gt;field = $value;
    }

    public function getField()
    {
        return $this-&gt;field;
    }
}
</code></pre>
<h4 id=使用-tableize-变形选项的示例>使用 tableize 变形选项的示例：</h4>
<pre><code class=language-bash>$ php app.php create:entity my -f int_field:int -f stringField:string -i t
</code></pre>
<p>生成的类（<code>&lt;app directory>/src/Database/My.php</code>）代码如下：</p>
<pre><code class=language-php>use Cycle\Annotated\Annotation as Cycle;

/**
 * @Cycle\Entity()
 */
class My
{
    /**
     * @Cycle\Column(type = &quot;int&quot;)
     */
    public $int_field;

    /**
     * @Cycle\Column(type = &quot;string&quot;, name = &quot;string_field&quot;)
     */
    public $stringField;
}
</code></pre>
<h4 id=使用-camelize-变形选项的示例>使用 camelize 变形选项的示例：</h4>
<pre><code class=language-bash>$ php app.php create:entity my -f int_field:int -f stringField:string -i c
</code></pre>
<p>生成的类（<code>&lt;app directory>/src/Database/My.php</code>）代码如下：</p>
<pre><code class=language-php>use Cycle\Annotated\Annotation as Cycle;

/**
 * @Cycle\Entity()
 */
class My
{
    /**
     * @Cycle\Column(type = &quot;int&quot;, name = &quot;intField&quot;)
     */
    public $int_field;

    /**
     * @Cycle\Column(type = &quot;string&quot;)
     */
    public $stringField;
}
</code></pre>
<h4 id=其它选项示例>其它选项示例：</h4>
<pre><code class=language-bash>$ php app.php create:entity my -r myRole -m MyMapper -t my_table -d my_db -e
</code></pre>
<p>生成的类（<code>&lt;app directory>/src/Database/My.php</code>）代码如下：</p>
<pre><code class=language-php>use Cycle\Annotated\Annotation as Cycle;

/**
 * @Cycle\Entity(role = &quot;myRole&quot;, mapper = &quot;MyMapper&quot;, repository = &quot;my&quot;, table = &quot;my_table&quot;, database = &quot;my_db&quot;)
 */
class My
{
}
</code></pre>
<p>同时会生成数据仓库类 (<code>&lt;app directory>/src/Repository/MyRepository.php</code>):</p>
<pre><code class=language-php>use Cycle\ORM\Select\Repository;

class MyRepository extends Repository
{
}
</code></pre>
</div>
<div class=article-widget>
<div class=post-nav>
<div class=post-nav-item>
<div class=meta-nav>上一页</div>
<a href=/docs/basics/prototype/ rel=next>原型开发辅助</a>
</div>
<div class=post-nav-item>
<div class=meta-nav>下一页</div>
<a href=/docs/start/structure/ rel=prev>应用程序结构</a>
</div>
</div>
</div>
</div>
<div class=body-footer>
<p>最近更新于 2020-04-13</p>
<p class=edit-page>
<a href=https://github.com/krwu/spiraldocs/edit/feat/chinese/zh_CN/basics/scaffolding.md>
<i class="fas fa-pen pr-2"></i>编辑本页
</a>
</p>
</div>
</article>
<footer class=site-footer>
<p class=powered-by><span class=copyright>© 2019 - 2021 <a href=https://studyspiral.cn/>StudySpiral</a> All rights reserved.</span>
</p>
<p class=powered-by>
<a href=http://www.beian.miit.gov.cn/ target=_blank rel="noopener noreferer">粤ICP备14011364号</a>
<a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=44030402001866" target=_blank rel="noopener noreferer"><img style=display:inline-block src=/img/gaba.png>粤公网安备 44030402001866号</a>
</p>
<p id=webify class=powered-by style=display:none>[<a href=https://webify.cloudbase.net/ target=_blank rel=noopener>CloudBase Webify</a>] 提供网站托管服务</p>
<script async defer>window.addEventListener('DOMContentLoaded',()=>{const{host:a}=window.location;a.toLocaleLowerCase()==='docs.studyspiral.cn'&&(document.getElementById('webify').style.display='block')})</script>
</footer>
</main>
</div>
</div>
<script src=https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin=anonymous></script>
<script src=https://cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/4.1.4/imagesloaded.pkgd.min.js integrity="sha256-lqvxZrPLtfffUl2G/e7szqSvPBILGbwmsGE1MKlOi0Q=" crossorigin=anonymous></script>
<script src=https://cdnjs.cloudflare.com/ajax/libs/jquery.isotope/3.0.6/isotope.pkgd.min.js integrity="sha256-CBrpuqrMhXwcLLUd5tvQ4euBHCdh7wGlDfNz8vbu/iI=" crossorigin=anonymous></script>
<script src=https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.js integrity="sha256-yt2kYMy0w8AbtF89WXb2P1rfjcP/HTHLT7097U8Y5b8=" crossorigin=anonymous></script>
<script src=https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/highlight.min.js integrity="sha256-eOgo0OtLL4cdq7RdwRUiGKLX9XsIJ7nGhWEKbohmVAQ=" crossorigin=anonymous></script>
<script src=https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/languages/go.min.js></script>
<script>const code_highlighting=!0</script>
<script>const isSiteThemeDark=!1</script>
<script>const search_config={indexURI:"/index.json",minLength:1,threshold:.3},i18n={no_results:"没有找到结果",placeholder:"搜索...",results:"搜索结果"},content_type={post:"文章",project:"项目",publication:"出版物",talk:"演讲"}</script>
<script src=https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.1.1/anchor.min.js integrity="sha256-pB/deHc9CGfFpJRjC43imB29Rse8tak+5eXqntO94ck=" crossorigin=anonymous></script>
<script>anchors.add()</script>
<script id=search-hit-fuse-template type=text/x-template>
      <div class="search-hit" id="summary-{{key}}">
      <div class="search-hit-content">
        <div class="search-hit-name">
          <a href="{{relpermalink}}">{{title}}</a>
          <div class="article-metadata search-hit-type">{{type}}</div>
          <p class="search-hit-description">{{snippet}}</p>
        </div>
      </div>
      </div>
    </script>
<script src=https://cdnjs.cloudflare.com/ajax/libs/fuse.js/3.2.1/fuse.min.js integrity="sha256-VzgmKYmhsGNNN4Ph1kMW+BjoYJM2jV5i4IlFoeZA9XI=" crossorigin=anonymous></script>
<script src=https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js integrity="sha256-4HLtjeVgH0eIB3aZ9mLYF6E8oU5chNdjU6p6rrXpl9U=" crossorigin=anonymous></script>
<script src=/js/academic.min.6f1005d1a84220e2f466ff3d8e712f31.js></script>
<div id=modal class="modal fade" role=dialog>
<div class=modal-dialog>
<div class=modal-content>
<div class=modal-header>
<h5 class=modal-title>引用</h5>
<button type=button class=close data-dismiss=modal aria-label=Close>
<span aria-hidden=true>&#215;</span>
</button>
</div>
<div class=modal-body>
<pre><code class="tex hljs"></code></pre>
</div>
<div class=modal-footer>
<a class="btn btn-outline-primary my-1 js-copy-cite" href=# target=_blank>
<i class="fas fa-copy"></i> 复制
</a>
<a class="btn btn-outline-primary my-1 js-download-cite" href=# target=_blank>
<i class="fas fa-download"></i> 下载
</a>
<div id=modal-error></div>
</div>
</div>
</div>
</div>
</body>
</html>